﻿using System;
using System.Collections.Generic;
using System.Web;

namespace FDeal
{
    public class TaiKhoanDoanhNghiepBUS
    {
        private TaiKhoanDoanhNghiepDAO _dDAO;

        public TaiKhoanDoanhNghiepBUS()
        {
            _dDAO = new TaiKhoanDoanhNghiepDAO();
        }

        public void Insert(TaiKhoanDoanhNghiepDTO obj)
        {
            _dDAO.insert(obj);
        }

        public void Insert(string idtaikhoan, string tendn, string diachi, string sdt, string mota)
        {
            TaiKhoanDoanhNghiepDTO obj = new TaiKhoanDoanhNghiepDTO();

            obj.Idtaikhoan = idtaikhoan;
            obj.Tendn = tendn;
            obj.Diachi = diachi;
            obj.Sdt = sdt;
            obj.Mota = mota;

            this.Insert(obj);
        }
        public void Delete(string idDeal)
        {
            _dDAO.delete(idDeal);
        }

        public void Update(TaiKhoanDoanhNghiepDTO obj)
        {
            _dDAO.update(obj);
        }

        public TaiKhoanDoanhNghiepDTO[] GetDsTaiKhoanDoanhNghiep()
        {
            return _dDAO.getDsTaiKhoanDoanhNghiep();
        }

        public TaiKhoanDoanhNghiepDTO GetDonHang(string idTKDN)
        {
            TaiKhoanDoanhNghiepDTO[] ds = this.GetDsTaiKhoanDoanhNghiep();

            for (int i = 0; i < ds.Length; i++)
            {
                if (ds[i].Idtaikhoan.Equals(idTKDN))
                    return ds[i];
            }
            return null;
        }
    }
}